package com.cass.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cass.entity.SocialPractice;
import com.cass.service.SocialPracticeService;
import com.cass.mapper.SocialPracticeMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
* @author 14000
* @description 针对表【social_practice】的数据库操作Service实现
* @createDate 2024-11-05 15:09:00
*/
@Service
public class SocialPracticeServiceImpl extends ServiceImpl<SocialPracticeMapper, SocialPractice>
    implements SocialPracticeService{
    @Override
    public List<String> getActivityDescriptionsByStudentId(Integer studentId) {
        QueryWrapper<SocialPractice> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("student_id", studentId);
        List<SocialPractice> socialPractices = list(queryWrapper);

        // 只提取活动描述
        return socialPractices.stream()
                .map(SocialPractice::getActivityDescription)
                .collect(Collectors.toList());
    }
}




